package com.wo.cloud.elasticsearch.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.time.Duration;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @author liry
 * @version 1.0
 * @date Created on 2021/3/24 23:49
 * Description: 从配置文件中加载 es 集群信息
 */


@Data
@ConfigurationProperties(prefix = "wo.cloud.es")
public class ElasticSearchProperties {

    // 默认健康检查地址
    private List<String> uris = new ArrayList<>(Collections.singletonList("http://localhost:9200"));

    private String username;
    private String password;

    // 连接超时时间
    private Duration connectionTimeout = Duration.ofSeconds(1L);

    // 获取读取数据超时时间
    private Duration readTimeout = Duration.ofSeconds(30L);
}
